STEP 16: To calculate where our ball should go, we need a new y-coordinate. bally (our current position) + rise (how far we move up) is the answer! But using rise will put the ball in the net every time! We need to use what the rise would be with the slope the user guessed. To get our new rise, we'll use slopeguess = rise/run and solve for rise!
In LOGIC, click and drag out Multiplication.
Change my_var to newrise, and replace 2*3 with slopeguess*run!
To navigate the page using the TAB key, first press ESC to exit the code editor.
t = codesters.Teacher()
newrises = t.find_text("newrise")
try:
tval1 = newrises[0][1].replace(" ", "")
except:
tval1 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == "newrise=slopeguess*run" , "Great Job!")
t1.add_failure(tval1 == "DNE", "Did you drag out Multiplication and change my_var to newrise?")
t1.add_failure("*" not in tval1, "Did you drag out a Multiplication command?")
t1.add_failure("slopeguess" not in tval1, "Did you change the 2 to slopeguess?")
t1.add_failure("run" not in tval1, "Did you change the 3 to run?")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
Are you already running a Codesters project in another tab or window?
Micro:bit can only connect to one web page at a time.
Try stopping other Codesters projects or closing
other tabs or windows that may be using your Micro:bit.
If that doesn't fix the problem try disconnecting your Micro:bit,
reloading this page, and reconnecting your Micro:bit.